Skip to content

Add regression test for spherical barycentric resampling fallback - #91

Merged
jnolan14 merged 1 commit into
freesurfer:masterfrom
inhuszar:fix/spherical-resampling-test
Nov 12, 2026
Merged

jnolan14 merged 1 commit into
freesurfer:masterfrom
inhuszar:fix/spherical-resampling-test

Conversation

@inhuszar

Copy link
Copy Markdown
Contributor

Covers the [0, 0, 0] "bullet hole" artefact fixed in bc523b6 (PR #77): on a source sphere with strongly non-uniform triangle sizes (dense polar caps, coarse equatorial belt, as left by spherical registration), target points inside large triangles next to the dense caps are not found among the k nearest centroids. barycentric_spherical_map() must fall back to the nearest face rather than returning face -1 with zero weights.

The neighborhood=3 case fails on the pre-fix code (every constructed target point is left unmapped and resamples to [0, 0, 0]) and passes after the fix. Also checks that barycentric resampling of a sphere onto itself stays on the sphere.

Covers the [0, 0, 0] "bullet hole" artefact fixed in bc523b6 (PR freesurfer#77):
on a source sphere with strongly non-uniform triangle sizes (dense polar
caps, coarse equatorial belt, as left by spherical registration), target
points inside large triangles next to the dense caps are not found among
the k nearest centroids. barycentric_spherical_map() must fall back to
the nearest face rather than returning face -1 with zero weights.

The neighborhood=3 case fails on the pre-fix code (every constructed
target point is left unmapped and resamples to [0, 0, 0]) and passes on
master. Also checks that barycentric resampling of a sphere onto itself
stays on the sphere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 0ed3280)
@jnolan14
jnolan14 merged commit 50a5324 into freesurfer:master Nov 12, 2026
12 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants